package mBio;

import java.io.FileNotFoundException;
import java.io.IOException;

import rfBio.Bioutil;
import rfBio.fasta;

public class extract_fasta {

		public static void main(String[] args)
		 throws IOException, FileNotFoundException{
			
			Bioutil test = new Bioutil();
			


			if(args.length != 4){
				System.out.println("Wrong number of parameters!" + '\n' + "Usage: extract_fasta infile list outfile type.");
				System.exit(0);
				
			}

			if( (args[3].equals("p")) || (args[3].equals("P")) || (args[3].equals("d")) || (args[3].equals("D")) || (args[3].equals("r")) || (args[3].equals("R")) ){
				// type OK
			}
			else{
				System.out.println("Invalide type. as to be either p,d or r");
				System.exit(0);
			}
			fasta f = new fasta(args[0], args[1], 1);
			
			if( (args[3] == "p") || (args[3] == "P")){
				f.set_type("p");
			}
			if( (args[3] == "d") || (args[3] == "D")){
				f.set_type("d");
			}
			if( (args[3] == "r") || (args[3] == "R")){
				f.set_type("r");
			}
			f.clean();
			f.writeFasta(args[2]);
			
		}

	}